<link href="css/style.css" rel="stylesheet" type="text/css" />
<?php 
if(!isset($_SESSION)) 
	{ 
		session_start(); 
	}
$user=$_SESSION['fullname'];
include 'operations/connection.php';
$mlisttype=mysql_query("select template.IDTemplate,staticlang.".$_SESSION['lang']." from template,staticlang where template.IDConfigStaticLang=staticlang.IDConfigStaticLang and template.IDTemplate!=3") ;
if(!isset($_REQUEST['typedocsearh'])){
	$typedockey = "";
	$mkq=mysql_query("SELECT typedoc.IDTypeDoc,tdn.".$_SESSION['lang']." as tdname,tpn.".$_SESSION['lang']." as tpname from typedoc,staticlang tdn, staticlang tpn,template 
	where typedoc.IDTypeDoc>6 and typedoc.IDTypeDoc!=11 
	and typedoc.IDConfigStaticLang = tdn.IDConfigStaticLang
	and typedoc.IDTemplate = template.IDTemplate 
	and template.IDConfigStaticLang = tpn.IDConfigStaticLang ORDER BY typedoc.IDTypeDoc asc");
}

?>
<script type="text/javascript">
function xlsearch(ngongnu)
{

	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
										    	document.getElementById("viewsearch").innerHTML=xmlhttp.responseText;
										  }
									  }
	key=document.getElementById("typedockey").value;
	id=document.getElementById("listtypedoc").value;
	
	xmlhttp.open("GET","ajax/new-document.php?namekey="+key+"&xlang="+ngongnu+"&idtemplate="+id,true);
	xmlhttp.send();
}
</script>
<div class="title"></div>
<form method="post" action="#"  name="newlist">
<div class="main_content"  style="min-height: 895px">  
		<div class="tr_title"><?php echo $l_Approvaldocument;?> </div>	   
			<table class="tcontent" cellpadding="5" cellspacing="0" style="border-color:#c5d1e8; margin-top:15px">
            	<tr>
				  <td style="border-color:#c5d1e8; background:#f5f5f5" width="120"><?php echo $l_document_form;?></td>
					<td style="border-color:#c5d1e8">
                        <div align="left">
                          <select class="com_tit" name="listtypedoc" id="listtypedoc">
                          <option value="ALL"><?php echo $l_all;?></option>
                          <?php 
                          while($row=mysql_fetch_array($mlisttype)){
                          	?>
							<option value="<?php echo $row[IDTemplate]?>" 
								<?php 
									if($_REQUEST['listtypedoc']==$row[IDTemplate]){
										?>
										selected="selected"
								<?php 
                          			}
								?>
							>
								<?php echo $row[$_SESSION['lang']]?>
							</option>                          	
                          	<?php 
                          }
                          ?>
                          </select>
                        </div></td>
                  <td style="border-color:#c5d1e8" width="100" rowspan="2" align="center">
                  <input type="button" onclick="xlsearch('<?php echo $_SESSION['lang']; ?>')" name="typedocsearh" value="<?php echo $l_search;?>" class="btn_search_new" />
                  </td>
                 </tr>
                 <tr>
                   <td style="border-color:#c5d1e8; background:#f5f5f5"><?php echo $l_Searchkey;?></td>
                    <td style="border-color:#c5d1e8"><input type="text" name="typedockey" id="typedockey" value="<?php echo $typedockey;?>" style="height:24px; width:100%; border:1px solid #c4c0c9;line-height: 24px;" /></td>
                 </tr>              
          </table>
          <div id="viewsearch">
            <table cellpadding="5" cellspacing="0" class="rf_dt" >
                <tr  class="table_new">
                <td width="10%"><?php echo $l_no;?></td>
                <td width="35%"><?php echo $l_DocumentName;?></td>
                <td width="45%"><?php echo $l_title;?></td>
                <td width="10%"><?php echo $l_View;?></td>
                </tr>
                <?php 
                	if(count($mkq)>0){
                		$vitri=0;
                		while ($row=mysql_fetch_array($mkq)){
                			$vitri++;
                			?>
                			<tr>
			                <td><div align="center"><?php echo $vitri;?></div></td>
			                <td><?=$row[tpname]?></td>
			                <td><a href="newform-<?php echo $row[IDTypeDoc];?>&newform"><?=$row[tdname]?></a></td>
			                <td><div class="view_button"><a href="newform-<?php echo $row[IDTypeDoc];?>&newform"><img src="images/new.png" alt="" /></a></div></td>
			                </tr>
                			<?php   
                		}
                	}
                ?>
            </table>
            </div>
            <div class="tr_title"><?php echo $l_meeting_document;?> </div>
            <table cellpadding="5" cellspacing="0" class="rf_dt">
                <tr  class="table_new">
                <td width="10%"><?php echo $l_no;?></td>
                <td width="35%"><?php echo $l_DocumentName;?></td>
                <td width="45%"><?php echo $l_title;?></td>
                <td width="10%"><?php echo $l_View;?></td>
                </tr>
                <tr>
                <td><div align="center">1</div></td>
                <td><?php echo $l_meetingform;?></td>
                <td><a href="newform-11&newform"><?=$l_meeting_document?></a></td>
                <td><div class="view_button"><a href="newform-11&newform"><img src="images/new.png" alt="" /></a></div></td>
                </tr>
            </table>
           
      </div>
      
      </form>